package lambda;

/**
 * @PackageName: lambda
 * @ClassName: TestInterface
 * @Description:
 * @author: RZS
 * @date: 2023/3/16  11:09
 */
public class TestInterface {
    public static void main(String[] args) {
        InterFaceDemo ifd = new InterFaceDemo() {
            @Override
            public int start(int a, int b) {
                System.out.println("接口当中的方法");
                return a + b;
            }
        };

        System.out.println(ifd.start(1, 3));

        System.out.println(
                num(new InterFaceDemo() {
                    @Override
                    public int start(int a, int b) {
                        System.out.println("接口当中的方法");
                        return a + b;
                    }
                }, 1, 3)
        );

        System.out.println(
               num((a,b) -> a + b, 1, 3)
        );


    }

    public static int num(InterFaceDemo ifd, int num1, int num2){
        return ifd.start(num1, num2);
    }


}
